#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int findKthLargest(vector<int>& nums, int k) {
        priority_queue<int, std::vector<int>, std::greater<int>> topk(nums.begin(), nums.begin() + k);
        for (int i = k; i < nums.size(); ++i)
        {
            if (nums[i] > topk.top())
            {
                topk.pop();
                topk.push(nums[i]);
            }
        }

        return topk.top();

    }
};